<?php

function code($data)
{
	echo '<pre>';
	print_r($data);
	echo '</pre>';
}

// =============================================================================

function alerts()
{
  $CI =& get_instance();

  $alert = '';
  
  switch ($CI->session->flashdata('alert'))
  {
    case 'saved':
      $alert->message = 'Your note has been successfully saved.';
      $alert->type    = 'success';
      break;
    
    case 'no edit':
      $alert->message = 'You are not allowed to edit this note.';
      $alert->type    = 'error';
      break;
    
    case 'not exist':
      $alert->message = 'This note does not exist.';
      $alert->type    = 'error';
      break;
    
    case 'no view':
      $alert->message = 'This is not a public note.';
      $alert->type    = 'error';
      break;
    
    case 'public':
      $alert->message = 'The note is now publicly viewable';
      $alert->type    = 'warning';
      break;
    
    case 'private':
      $alert->message = 'The note is now private.';
      $alert->type    = 'warning';
      break;
    
    case 'deleted':
      $alert->message = 'The note has been deleted.';
      $alert->type    = 'warning';
      break;
    
    case 'email y':
      $alert->message = 'Your email address has been updated.';
      $alert->type    = 'success';
      break;
    
    case 'email p_n':
      $alert->message = 'The password you entered is incorrect.';
      $alert->type    = 'error';
      break;
    
    case 'email e_n':
      $alert->message = 'An account with this email already exists.';
      $alert->type    = 'error';
      break;
    
    case 'password y':
      $alert->message = 'Your password has been updated.';
      $alert->type    = 'success';
      break;
    
    case 'password c_n':
      $alert->message = 'Your current password is incorrect.';
      $alert->type    = 'error';
      break;
    
    case 'password n_n':
      $alert->message = 'The new passwords don\'t match.';
      $alert->type    = 'error';
      break;
    
    case 'login':
      $alert->message = 'Incorrect email or password.';
      $alert->type    = 'error';
      break;
    
    case 'verify':
      $alert->message = 'Please verify your email address. <a href="#">Resend email</a>.';
      $alert->type    = 'error';
      $alert->persist = TRUE;
      break;
    
    case 'disabled':
      $alert->message = 'This account has been disabled';
      $alert->type    = 'error';
      break;
  }
  
  return $alert;
}

// =============================================================================


function title($title = '')
{
  switch ($title)
  {
    case '':
    case 'home':
    case 'index':
      return 'Stune';
      break;
    
    default:
      return $title . ' | Stune';
  }
}

// End of File